import request from '@/utils/request'

export default {
  selectByPage(page, limit, userQuery) {
    return request({
      url: `/rbac/user/selectByPage?page=${page}&limit=${limit}`,
      method: 'get',
      params: userQuery
    })
  },
  deleteById(id) {
    return request({
      url: `/rbac/user/deleteById/${id}`,
      method: 'delete'
    })
  },
  // '1,2,3'
  deleteAll(ids) {
    return request({
      url: `/rbac/user/deleteAll/${ids}`,
      method: 'delete'
    })
  },
  add(user) {
    return request({
      url: `/rbac/user/add`,
      method: 'post',
      data: user // 封装json传到后台@RequestBody
    })
  },
  selectById(id) {
    return request({
      url: `/rbac/user/selectById/${id}`,
      method: 'get'
    })
  },
  update(user) {
    return request({
      url: `/rbac/user/update`,
      method: 'put',
      data: user
    })
  },
  updateStatus(id, status) {
    return request({
      url: `/rbac/user/updateStatus/${id}/${status}`,
      method: 'put'
    })
  },
  exportData() {
    return request({
      url: `/rbac/user/exportData`,
      method: 'get',
      //XMLHttpRequest 属性 responseType 是一个枚举字符串值，用于指定响应中包含的数据类型。
      //"blob": response 是一个包含二进制数据的 Blob 对象。
      responseType: 'blob'
    })
  },
}


// export function selectByPage(page, limit) {
//   return request({
//     url: `/rbac/user/selectByPage?page=${page}&limit=${limit}`,
//     method: 'get'
//   })
// }